<?php

/**
 * Base project form.
 * 
 * @package    seth
 * @subpackage form
 * @author     Your name here 
 * @version    SVN: $Id: BaseForm.class.php 20147 2009-07-13 11:46:57Z FabianLange $
 */
class PowerdevFixturesForm extends sfFormSymfony
{
  public function configure()
  {
    $this->setWidget('plant', new sfWidgetFormDoctrineChoice(array(
                                        'model'=>'Plant', 
                                        'add_empty'=>False, 
                                        'query' => Doctrine_Query::create()->from('Plant p')->select('id, name')->where('1'),
                                         ))
                            );
    $this->setWidget('file', new sfWidgetFormInputFile());
    
    $this->setValidators(array(
        'file'=>new sfValidatorFile(array('required' => false)),
        'plant'=>new sfValidatorDoctrineChoice(array(
                                        'model'=>'Plant', 
                                        'query' => Doctrine_Query::create()->from('Plant p')->select('id, name')->where('1'),
                                        ))
        ));                   
    
    $this->widgetSchema->setHelp("plant","Click to Download the model file. Fill it with the Power Devices you want to insert and then Upload the file");
    $this->widgetSchema->setHelp("file","Upload the excel file with power devices");
    
    $this->widgetSchema->setNameFormat('fixtures[%s]');
  
  }  
}
